GBML manual / Core

profile_enabled

True if this game was built with the frame profiler switched on. When it is off, every profile_ number reads 0.

Works differently on Game Boy - The Game Boy has no frame profiler: profile_enabled says false and every profile number reads 0.

Works differently on Game Boy Color - The Game Boy Color has no frame profiler: profile_enabled says false and every profile number reads 0.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

profile_enabled() -> bool

Returns

bool

Description

Answers one question: was this game built with the frame profiler switched on? The profiler measures where each frame's time goes, and the other profile_ calls read what it measured (see The frame profiler). It starts out off, because it is a tool for finding slow spots while you make the game, not for the game you hand to players. When it is off, every profile_ number reads 0, so an overlay built from them shows nothing useful. This call lets that overlay say so, or hide itself.

Example

if (!profile_enabled()) {
    draw_text(4, 4, "PROFILER OFF");
}

Draws a small reminder when the profiler is off, instead of a screen full of zeros.

Cost

With the profiler off this is the plain value false. The build sees that, so the if and everything inside it are thrown away and take no space and no time at all.

On the GBA

The profiler is a build switch and it starts OFF, so a finished game pays nothing for it: with the switch off this call is the constant false, and the build throws away the code around it. Turn it on with --profile when you build (see the Frame profiler page).

See also: profile_phasesprofile_percent